﻿

using ProtoBuf;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IotContract.Dtos.Clients;
/// <summary>
/// 库位
/// </summary>
[ProtoContract]
public class FmtStageInfoDto
{
    /// <summary>
    /// 模式,0 auto  1 local
    /// </summary>
    [ProtoMember(1)]
    public string StageMode
    {
        get;
        set;
    }
    [ProtoMember(2)]
    public string StageNo
    {
        get;
        set;
    }
    /// <summary>
    /// 0:OFF 未启用, 1:Vacancy可预约（库位为空）, 2:Tray In 已进盘未测试, 3:Running 测试中, 4:End 测试完成, 5:Error 库位错误（唯一产生报警的状态值）,6: Ready 已预约未进盘, 7:Contact Check Contact Checking
    /// </summary>
    [ProtoMember(3)]
    public string StageStatus
    {
        get;
        set;
    }

    /// <summary>
    /// 0 未接收 1 已接收 2 结果已提交
    /// </summary>
    [ProtoMember(4)]
    public int Status
    {
        get;
        set;
    }

    public string Color
    {
        get
        {
            if (StageStatus == "5")
            {
                return "background-color:#F44336";
            }
            if (StageStatus == "1")
            {
                return "background-color:#8BC34A";
            }
            if (StageStatus == "2")
            {
                return "background-color:#CDDC39";
            }
            if (StageStatus == "3")
            {
                return "background-color:#03A9F4";
            }

            if (StageStatus == "6")
            {
                return "background-color:#C5E1A5";
            }
            if (StageStatus == "4")
            {
                return "background-color:#9C27B0";
            }
            if (StageStatus == "7")
            {
                return "background-color:#E91E63";
            }

            return "background-color:white";
        }
    }

    /// <summary>
    /// 状态
    /// </summary>
    public string StageStatusType
    {
        get
        {
            if (StageStatus == "0")
            {
                return "未启用";
            }
            else if (StageStatus == "1")
            {
                return "可预约";
            }
            else if (StageStatus == "2")
            {
                return "已进盘未测试";
            }
            else if (StageStatus == "3")
            {
                return "测试中";
            }
            else if (StageStatus == "4")
            {
                return "测试完成";
            }
            else if (StageStatus == "5")
            {
                return "库位错误";
            }
            else if (StageStatus == "6")
            {
                return "已预约未进盘";
            }
            else
            {
                return "未知状态";
            }
        }
    }

    public FmtStageInfoDto()
    {
        this.StageNo = " ";
        this.StageMode = " ";
        this.StageStatus = " ";

    }
}
